home *** CD-ROM | disk | FTP | other *** search
- // (C) Copyright Microsoft Corp. 1991. All rights reserved.
- //
- // You have a royalty-free right to use, modify, reproduce and
- // distribute the Sample Files (and/or any modified version) in
- // any way you find useful, provided that you agree that
- // Microsoft has no warranty obligations or liability for any
- // Sample Application Files which are modified.
-
-
- /****************************************************************************
-
- MODULE : MCIUTILS.C
-
- PURPOSE : This module contains helper functions which work specifically with the functions contained
- in the MCI module.
-
- FUNCTIONS :
- SeekAllToStart
- StopAllWaveFiles
- HideAllWindows
- FreeDevices
- AllDone
-
-
- COMMENTS :
-
- HISTORY :
-
- ****************************************************************************/
-
- #include "windows.h"
- #include <stdlib.h>
- #include "playvfw.h"
- #include "proto.h"
- #include "mmsystem.h"
- #include <digitalv.h>
- #include <stdio.h>
- #include <time.h>
-
- /****************************************************************************
-
- FUNCTION : SeekAllToStart()
-
- PURPOSE : This function takes all the AVI files and positions them at the begining.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/7/93
-
- ****************************************************************************/
-
- BOOL FAR PASCAL SeekAllToStart()
- {
-
- SeekVFWToStart(lpDevice1->wDeviceID);
- lpDevice1->bVideoPlaying=FALSE;
- SeekVFWToStart(lpDevice2->wDeviceID);
- lpDevice2->bVideoPlaying=FALSE;
- SeekVFWToStart(lpDevice3->wDeviceID);
- lpDevice3->bVideoPlaying=FALSE;
- SeekVFWToStart(lpDevice4->wDeviceID);
- lpDevice4->bVideoPlaying=FALSE;
- SeekVFWToStart(lpDevice5->wDeviceID);
- lpDevice5->bVideoPlaying=FALSE;
- SeekVFWToStart(lpDevice6->wDeviceID);
- lpDevice6->bVideoPlaying=FALSE;
-
-
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : StopAllWaveFiles()
-
- PURPOSE : This function takes all wave files and stops them. This is to ensure that when
- a wave file for a button starts playing all other wave files are stopped.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/7/93
-
- ****************************************************************************/
-
- BOOL FAR PASCAL StopAllWaveFiles()
- {
-
-
- StopWaveFile(lpDevice1->wAudioDeviceID);
- lpDevice1->bAudioPlaying=FALSE;
-
- StopWaveFile(lpDevice2->wAudioDeviceID);
- lpDevice2->bAudioPlaying=FALSE;
-
- StopWaveFile(lpDevice3->wAudioDeviceID);
- lpDevice3->bAudioPlaying=FALSE;
-
- StopWaveFile(lpDevice4->wAudioDeviceID);
- lpDevice4->bAudioPlaying=FALSE;
-
- StopWaveFile(lpDevice5->wAudioDeviceID);
- lpDevice5->bAudioPlaying=FALSE;
-
- StopWaveFile(lpDevice6->wAudioDeviceID);
- lpDevice6->bAudioPlaying=FALSE;
-
-
-
- return TRUE;
- }
-
- /****************************************************************************
-
- FUNCTION : HideAllWindows()
-
- PURPOSE : This function hides all video windows. This function is used when we
- transition between pages.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL HideAllWindows()
- {
- ShowWindow( lpDevice1->hWnd, SW_HIDE );
- ShowWindow( lpDevice2->hWnd, SW_HIDE );
- ShowWindow( lpDevice3->hWnd, SW_HIDE );
- ShowWindow( lpDevice4->hWnd, SW_HIDE );
- ShowWindow( lpDevice5->hWnd, SW_HIDE );
- ShowWindow( lpDevice6->hWnd, SW_HIDE );
- ShowWindow( lpDevice7->hWnd, SW_HIDE );
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
- return TRUE;
- }
-
-
- /****************************************************************************
-
- FUNCTION : FreeDevices(HWND)
-
- PURPOSE : This function frees all currently open devices. This function is used to
- ensure that all devices are closed at the end of the program.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93
-
- ****************************************************************************/
-
-
- BOOL FAR PASCAL FreeDevices(hWnd)
- HANDLE hWnd;
- {
-
- BOOL bReturn;
-
- //MSG msg;
-
-
-
-
- if (lpDevice1->wAudioDeviceID)
- {
- bReturn = CloseWaveFile(lpDevice1->wAudioDeviceID);
- lpDevice1->wAudioDeviceID=0;
- }
-
-
- if (lpDevice2->wAudioDeviceID)
- {
-
- bReturn = CloseWaveFile(lpDevice2->wAudioDeviceID);
- lpDevice2->wAudioDeviceID=0;
- }
-
-
- if (lpDevice3->wAudioDeviceID)
- {
- bReturn = CloseWaveFile(lpDevice3->wAudioDeviceID);
- lpDevice3->wAudioDeviceID=0;
- }
-
- if (lpDevice4->wAudioDeviceID)
- {
- bReturn = CloseWaveFile(lpDevice4->wAudioDeviceID);
- lpDevice4->wAudioDeviceID=0;
- }
-
-
-
- if (lpDevice5->wAudioDeviceID)
- {
- bReturn = CloseWaveFile(lpDevice5->wAudioDeviceID);
- lpDevice5->wAudioDeviceID=0;
- }
-
-
-
- if (lpDevice6->wAudioDeviceID)
- {
- bReturn = CloseWaveFile(lpDevice6->wAudioDeviceID);
- lpDevice6->wAudioDeviceID=0;
- }
-
-
- if (wGlobalAudioDeviceID)
- {
- bReturn = CloseWaveDevice(wGlobalAudioDeviceID);
- wGlobalAudioDeviceID=0;
- }
-
-
-
- if (lpDevice1->wDeviceID)
- {
- bReturn = CloseVFWFile(lpDevice1->wDeviceID);
- lpDevice1->wDeviceID=0;
- }
-
-
- if (lpDevice2->wDeviceID)
- {
- bReturn = CloseVFWFile(lpDevice2->wDeviceID);
- lpDevice2->wDeviceID=0;
- }
-
-
- if (lpDevice3->wDeviceID)
- {
- bReturn = CloseVFWFile(lpDevice3->wDeviceID);
- lpDevice3->wDeviceID=0;
- }
-
-
- if (lpDevice4->wDeviceID)
- {
- bReturn = CloseVFWFile(lpDevice4->wDeviceID);
- lpDevice4->wDeviceID=0;
- }
-
-
-
- if (lpDevice5->wDeviceID)
- {
- bReturn = CloseVFWFile(lpDevice5->wDeviceID);
- lpDevice5->wDeviceID=0;
- }
-
-
- if (lpDevice6->wDeviceID)
- {
- bReturn = CloseVFWFile(lpDevice6->wDeviceID);
- lpDevice6->wDeviceID=0;
- }
-
- if (lpDevice9->wDeviceID)
- {
- bReturn = CloseVFWFile(lpDevice9->wDeviceID);
- lpDevice9->wDeviceID=0;
- }
-
-
- if (wGlobalDeviceID)
- {
- bReturn = CloseVFWDevice(hWnd,wGlobalDeviceID);
- wGlobalDeviceID=0;
- }
-
-
-
- /* grey menu item first */
- /* enable second */
-
- return TRUE;
-
- }
-
- /****************************************************************************
-
- FUNCTION : AllDone()
-
- PURPOSE : This program checks to see if a right button click has occured and a Video isn't still playing.
- If this case is true then return true.
-
- COMMENTS :
-
- HISTORY : Created by Steven Molstad 8/1/93.
-
- ****************************************************************************/
-
- BOOL FAR PASCAL AllDone()
- {
- if (lpDevice1->bRButtonClicked || lpDevice2->bRButtonClicked || lpDevice3->bRButtonClicked ||
- lpDevice4->bRButtonClicked || lpDevice5->bRButtonClicked || lpDevice6->bRButtonClicked)
- {
- if (!lpDevice1->bVideoPlaying && !lpDevice2->bVideoPlaying && !lpDevice3->bVideoPlaying
- && !lpDevice4->bVideoPlaying && !lpDevice5->bVideoPlaying && !lpDevice6->bVideoPlaying)
- {
- return TRUE;
- }
- else
- return FALSE;
- }
- else
- return FALSE;
-
- }
-
-